Product
Socket Now Supports uv.lock Files
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
babel-plugin-transform-es2015-unicode-regex
Advanced tools
The babel-plugin-transform-es2015-unicode-regex package is a Babel plugin that transforms ES2015 Unicode regexes into equivalent ES5 regexes. This allows developers to use Unicode regex features in environments that do not natively support them.
Transform Unicode Regex
This feature allows you to write Unicode regex patterns using the ES2015 syntax and have them transformed into equivalent ES5-compatible regex patterns. This is useful for ensuring compatibility across different JavaScript environments.
const regex = /\u{1F4A9}/u; // ES2015 Unicode regex
const transformedRegex = new RegExp('\\u{1F4A9}', 'u'); // Transformed to ES5 compatible regex
regexpu-core is a package that transforms Unicode-aware regular expressions to ES5-compatible regular expressions. It provides similar functionality to babel-plugin-transform-es2015-unicode-regex but can be used independently of Babel.
regexgen is a tool that generates regular expressions from a list of strings. While it does not specifically focus on Unicode transformations, it can be used to create optimized regex patterns that may include Unicode characters.
Compile ES2015 unicode regex to ES5
In
var string = "foo💩bar";
var match = string.match(/foo(.)bar/u);
Out
var string = "foo💩bar";
var match = string.match(/foo((?:[\0-\t\x0B\f\x0E-\u2027\u202A-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]))bar/);
npm install --save-dev babel-plugin-transform-es2015-unicode-regex
.babelrc
(Recommended).babelrc
{
"plugins": ["transform-es2015-unicode-regex"]
}
babel --plugins transform-es2015-unicode-regex script.js
require("babel-core").transform("code", {
plugins: ["transform-es2015-unicode-regex"]
});
FAQs
Compile ES2015 Unicode regex to ES5
The npm package babel-plugin-transform-es2015-unicode-regex receives a total of 0 weekly downloads. As such, babel-plugin-transform-es2015-unicode-regex popularity was classified as not popular.
We found that babel-plugin-transform-es2015-unicode-regex demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 6 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Research
Security News
Socket researchers have discovered multiple malicious npm packages targeting Solana private keys, abusing Gmail to exfiltrate the data and drain Solana wallets.
Security News
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.